<?php require '../includes/security.php'; ?>

<?php require_once('../Connections/connection.php'); ?>
<?php

$id_stanza = $_GET['id_stanza'];

$nome_stanza = GetSQLValue("select Titolo from stanze where id_stanza=".$id_stanza);


mysql_select_db($database_setroma, $setroma);
$query_oggetti = "SELECT * FROM oggetto where id_stanza=".$id_stanza;
$oggetti = mysql_query($query_oggetti, $setroma) or die(mysql_error());
$row_oggetti = mysql_fetch_assoc($oggetti);
$totalRows_oggetti = mysql_num_rows($oggetti);





?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Elementi Stanza <?php echo $nome_stanza;?></title>
<head>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript" src="../thickbox.js"></script>
<script type="text/javascript" src="../scripts/BubbleTooltips.js"></script>
<link rel='stylesheet' type='text/css' href='../styles/style.css' />
<link rel='stylesheet' type='text/css' href='../thickbox.css' />

<?php include '../includes/jsscripts.php'; ?>

</head>


<body>
<h1>SiteRoom - Amministrazione, stanza <?php echo $nome_stanza;?> </h1>
<a href="javascript:popUp('../admin.php?id_stanza=<?php echo $id_stanza; ?>');">Organizza</a>
 &nbsp; <a href="javascript:popUp('../index.php?id_stanza=<?php echo $id_stanza; ?>');">Anteprima</a> 
<br><br>
<table  class="sofT">
<tr>
	<td colspan="2" class="helpHed">Elementi nella stanza</td>
	<td class="helpHed"><a href="inserisci_oggetto.php?id_stanza=<?php echo $id_stanza; ?>">Nuovo Oggetto</a></td>
	<td class="helpHed"><a href="inserisci_porta.php?id_stanza=<?php echo $id_stanza; ?>">Nuova Porta</a></td>
	<td class="helpHed"><a href="inserisci_galleria.php?id_stanza=<?php echo $id_stanza; ?>">Nuova Galleria</a></td>
</tr>
  <tr>
    <td class="helpHed">ID</td>
    <td class="helpHed">Nome</td>
    <td class="helpHed">Immagine</td>
	<td class="helpHed"></td>
	<td class="helpHed"></td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_oggetti['id_oggetto']; ?></td>
      <td><?php echo $row_oggetti['Nome']; 
if ($row_oggetti['tipologia']==1) {
	echo " (Oggetto)";
	$oggetto_corrente = "oggetto";
}
if ($row_oggetti['tipologia']==2) {
	echo " (Porta)";
	$oggetto_corrente = "porta";
}
if ($row_oggetti['tipologia']==3) {
	echo " (Galleria)";
	$oggetto_corrente = "galleria";
}

?></td>
      <td><a href="../userfiles/images/<?php echo $row_oggetti['Immagine']; ?>" class="thickbox"><img src="../userfiles/images/<?php echo $row_oggetti['Immagine']; ?>" height=50px /></a></td>
	  <td><a href="modifica_oggetto.php?id_oggetto=<?php echo $row_oggetti['id_oggetto']; ?>&id_stanza=<?php echo $id_stanza; ?>">Modifica</a></td>
	  <td><a href="elimina_oggetto.php?id_oggetto=<?php echo $row_oggetti['id_oggetto']; ?>&id_stanza=<?php echo $id_stanza; ?>" onclick="return confirm('Sei sicuro di vole cancellare l\'oggetto?\nUna volta rimosso non sara\' possibile recuperarlo!')">Elimina</a></td>

    </tr>
    <?php } while ($row_oggetti = mysql_fetch_assoc($oggetti)); ?>
</table>
<?php include '../includes/admin_footer.php'; ?>
</body>
</html>
<?php
mysql_free_result($oggetti);
?>
